<template>
  <div id="btnItem" class="page-header">
    <div v-if="isTitle" class="left">
      <div class="page-name">{{ route.meta.title }}</div>
    </div>
    <div v-else class="header-tab-box df aic">
      <div class="tab-item" :class="state.tabId === '1' ? 'active' : ''" @click="handleTabChange('1')">
        待审核
      </div>
      <div class="tab-item" :class="state.tabId === '2' ? 'active' : ''" @click="handleTabChange('2')">
        已审核
      </div>
      <div
        v-if="isClique"
        class="tab-item"
        :class="state.tabId === '3' ? 'active' : ''"
        @click="handleTabChange('3')"
      >
        集团债务信息统计
      </div>
    </div>
    <div class="right header-btn-box df aic">
      <slot></slot>
    </div>
  </div>
</template>

<script setup lang="ts">
const props = defineProps({
  isTitle: {
    type: Boolean,
    default: true
  },
  isClique: {
    type: Boolean,
    default: false
  }
})
const emit = defineEmits(['handleTab'])
const state = reactive({
  tabId: '1'
})
const route = useRoute()
const handleTabChange = (val: string) => {
  state.tabId = val
  emit('handleTab', val)
}
</script>

<style lang="scss" scoped>
.page-header {
  background: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-sizing: border-box;
  padding-bottom: 10px;
  border-bottom: 1px solid #ccc;
  margin-bottom: 10px;
}
.page-name {
  font-size: 20px;
  font-weight: 500;
  color: #666666;
}
.header-tab-box {
  position: relative;
  top: 10px;
  padding: 0px 18px;
  box-sizing: border-box;
  .tab-item {
    font-size: 16px;
    padding-bottom: 18px;
    border-bottom: 2px solid transparent;
    box-sizing: border-box;
    cursor: pointer;
    color: #999999;
    &:not(:last-child) {
      margin-right: 25px;
    }
  }
  .active {
    color: $blue;
    border-bottom: 2px solid $blue;
  }
}
</style>
<style lang="scss">
.header-btn-box {
  .btn {
    height: 30px;
    background: rgba(85, 141, 247, 0.1);
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    border: 1px solid $blue;
    padding: 0px 9px;
    text-align: center;
    line-height: 30px;
    color: $blue;
    font-size: 16px;
    cursor: pointer;
    &:not(:last-child) {
      margin-right: 9px;
    }
    .iconfont {
      margin-right: 4px;
    }
  }
}
</style>
